import { legacy_createStore as createStore, combineReducers } from 'redux'
import { CollapsedReducer } from './reducers/CollapsedReducer'
import { LoadingReducer } from './reducers/LoadingReducer'

import { persistStore, persistReducer } from 'redux-persist'
import storage from 'redux-persist/lib/storage'
const persistConfig = {
  key: 'admin',
  storage,
  blacklist: ['LoadingReducer'], // 黑名单，还有白名单可以使用
}

const reducers = combineReducers({
  CollapsedReducer,
  LoadingReducer,
})
const persistedReducer = persistReducer(persistConfig, reducers)

let store = createStore(persistedReducer)
let persistor = persistStore(store)

export { store, persistor }
